setTimeout(function(){
    if (localStorage.getItem("token")) {
        let user = `<a href="">${localStorage.username}</a>`;
        console.log(user)
        $('.user').html(user)
        let exit = '`<a href="" id="exit">退出</a>`'
        $('.exit').html(exit)
        $('#exit').click(function () {
            localStorage.clear();
            location.href = 'index.html'
        })
    }
    $('.cart').click(function () {
        if (!localStorage.getItem("token")) {
            alert("没有登陆，去登录")
            location.assign("http://localhost:3000/login.html")
            // location.href = './login.html'
        }
        else {
            location.assign("http://localhost:3000/cart.html")
        }
        console.log(111)
    })
    
},1000)